class MembersController < ApplicationController

  def initialize
    @styleName="my_infor"
  end
  
  # GET /members/1
  # GET /members/1.xml
  def show
    @member = Member.find(params[:id])
    respond_to do |format|
      if session[:accounts_id].to_s == params[:id]
        format.html { render :action => "edit" }
      else
        format.html # show.html.erb
        format.xml  { render :xml => @member }
      end
    end
  end

  # GET /members/1/edit
  def edit
    @pageTitle="编辑个人资料"
    @member = Member.find(params[:id])
    redirect_back_or_default('/') if session[:accounts_id] != @member[:accounts_id]
  end

  # PUT /members/1
  # PUT /members/1.xml
  def update
    @member = Member.find(params[:id])

    respond_to do |format|
      if @member.update_attributes(params[:member])
        flash.now[:notice] = 'Member was successfully updated.'
      else
        flash.now[:notice] = 'Member was failed updated.'
      end
      format.html { render :action => "edit" }
    end
  end

end
